package com.myApp.db;

import java.util.ArrayList;

import android.content.Context;

import com.myApp.pojo.Category;

/**
 * 分类对象类
 * 负责分类数据的增删查改
 */
public class Categorys extends ArrayList<Category> {
	
	private static final long serialVersionUID = 688159096375577309L;
	
	private static Categorys instance = null;
	
	private Categorys(){}
	
	public static Categorys getInstance(Context ct){
		
		if (instance == null){
			
			instance = new Categorys();
			
			instance.load(ct);
		}
		
		return instance;
	}
	
	/**
	 * 分类数据抽出
	 * 
	 * @param ct 上下文
	 */
	public boolean load(Context ct){
		
		DatabaseHelper dbHelper = new DatabaseHelper(ct);
		
		return dbHelper.loadAll(this);
	}
	
}
